<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 * Class ArticleFavorite
 *
 * @package App\Model
 * @method static \Illuminate\Database\Query\Builder|$this create(array $attributes = [])
 * @method static \Illuminate\Database\Query\Builder|$this find($id, $columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder|$this where($column, $operator = null, $value = null, $boolean = 'and')
 * @property-read \App\Model\Articles $article
 * @mixin \Eloquent
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite query()
 * @property int $id
 * @property int $user_id 用户id，对应users表
 * @property int $article_id 文章id，对应articles表
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite whereArticleId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\ArticleFavorite whereUserId($value)
 */
class ArticleFavorite extends Model
{
    protected $table = 'article_favorite';

    protected $fillable = ['article_id', 'user_id'];

    public function article()
    {
        return $this->hasOne(Articles::class, 'id', 'article_id');
    }
}
